package model.common.root;

import java.util.ArrayList;
import java.util.List;

public class Comment extends Element {

	// Attributes
	public String body;
	
	private List<Element> annotatedElements;
	
	// Constructors
	/**
	 * @param body
	 */
	public Comment(String body) {
		super(null);
		this.body = body;
	}
	
	/**
	 * @param body
	 * @param owner
	 */
	public Comment(String body, Element owner) {
		this(body);
		setOwner(owner);
		annotatedElements = new ArrayList<Element>();
		annotatedElements.add(owner);
	}
	
	// Methods
	/**
	 * @param element
	 */
	public void addAnnotatedelement(Element element) {
		if (annotatedElements != null) {
			annotatedElements = new ArrayList<Element>();
		}
		annotatedElements.add(element);
	}
	
	public boolean removeAnnotatedElement(Element element) {
		return annotatedElements != null ? annotatedElements.remove(element) : false;
	}
	
}
